<div class="container-fluid suredy-form" style="padding-top: 0">
	<div class="row">	
		<form name="form" id="form">
			<#if testType??>
				<input type="hidden" id="id" name="id" value="${area.id}" />
				<div class="form-group">
					<div class="input-group">
						<div class="input-group-addon">检测类型名称</div>
						<input type="text" class="form-control" id="name" name="name" value="${testType.name}"/>
					</div>
				</div>	
				<div class="form-group">
					<div class="input-group">
						<div class="input-group-addon">检测类型代码</div>
						<input type="text" class="form-control" id="code" name="code"  value="${testType.code}"/>
					</div>
				</div>
				<div class="form-group">
					<div class="input-group">
						<div class="input-group-addon">实验项</div>
						<#if testItems ><#list testItems as item><input type="checkbox" id="testitem" name="testitem"  value="${item.code}"/>${item.name}</#list></#if>
					</div>
				</div>
				<div class="form-group">
					<div class="input-group">
						<div class="input-group-addon">描述</div>
						<textarea class="form-control" name="description" id="description" rows="3">${testType.description}</textarea>
					</div>
				</div>																									
			</#if>					
		</form>	
		<div class="text-center">
			<div class="btn btn-info" id="btn-save" >
				<i class="icon-save"></i> 保存
			</div>
		</div>																										
	</div>
</div>
<script type="text/javascript">
	$(document).ready(function() {				
		$('#btn-save').click(function() {
			var name = $('#name').val();
			if (name == '') {
				alert('请填写名称！');
				return;
			}
		


			$.ajax({
				url : 'app/testType/create-save',
				dataType : 'json',
				type : 'POST',
				data : $('#form').serialize(),
				success : function(success) {
					if (!success) {
						alert('新建信息失败！');
					} else if (!success.success) {
						alert('新建信息失败！\n\n' + success.msg);
					} else {
						alert('新建信息成功！');
						$.suredy.loadContent('app/testType/list');
						$.suredy.closeModal();
					}
				},
				error : function(a, b, c) {
					alert('服务器错误! ' + b);
				}
			});
		});	
	});
</script>	
